using MeetingManagement.Application.Common;
using System.Collections.Concurrent;

namespace MeetingManagement.Infrastructure
{
    public class SystemMessageService : ISystemMessageService
    {
        private static readonly ConcurrentDictionary<Guid, List<string>> _userMessages = new();
        public void Send(Guid userId, string message)
        {
            _userMessages.AddOrUpdate(userId,
                _ => new List<string> { message },
                (_, list) => { list.Add(message); return list; });
        }
        public static List<string> GetMessages(Guid userId)
        {
            _userMessages.TryGetValue(userId, out var msgs);
            return msgs ?? new List<string>();
        }
    }
}
